<?php
/**
*
* @package RCB - R/C Booking
* @version $Id: index.php 9 2009-04-10 09:32:13Z scott $
* @copyright (c) 2008 Scott Deakin
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'rcb/common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/rcb');

page_header($user->lang['RCB_TITLE']);

$template->set_filenames(array(
    'body' => 'rcb/index_body.html',
));

$sql = 'SELECT meeting_id, date, description, status 
       FROM '.RCB_MEETING_TABLE.
		' ORDER BY date';
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{

  $template->assign_block_vars('meetingrow', array(
        'MEETING_ID' => $row['meeting_id'],
        'DATE' => $row['date'],
        'DESCRIPTION' => $row['description'],
        'STATUS' => $row['status'],
		'S_BOOK_ALLOWED' => ( ($auth->acl_get('u_viewprofile') && 
									$row['status'] == 'Open') ||
								$auth->acl_get('m_edit') 
							),
		'S_EDIT_ALLOWED' => $auth->acl_get('m_edit'),
		'S_DELETE_ALLOWED' => ($auth->acl_get('m_edit') && 
								$row['status'] != 'Open'
							),
		'S_EXPORT_ALLOWED' => ($auth->acl_get('m_edit') &&
								$row['status'] != 'Open'
							)

         ));

}

$template->assign_vars( array(
	'S_ADD_ALLOWED' => $auth->acl_get('m_edit')
));

page_footer();
?>
